package proxy.demo2;

import proxy.demo1.IUserDao;
import proxy.demo1.UserDaoImpl;

/**
 * @author 1
 * @version 1.0
 * @description: TODO
 * @date 2024-08-27 13:43
 */
public class Ui {
    public static void main(String[] args) {
        //目标对象
        IUserDao target = new UserDaoImpl();
        System.out.println("目标对象:"+target.getClass());

        //执行代理工厂,获取代理对象
        IUserDao proxyInstance = (IUserDao) new ProxyFactory(target).getProxyInstance();
        System.out.println("代理对象:"+proxyInstance.getClass());
        //执行代理方法
        proxyInstance.save();
    }
}
